package com.study.composite.general.safe;

public class Test {
    public static void main(String[] args) {
        CompositeComponent branchRoot = new CompositeComponent("root");

        Leaf leafA = new Leaf("leafA");

        CompositeComponent branchA = new CompositeComponent("--branchA");
        Leaf leafB = new Leaf("leafB");
        branchA.addChild(leafB);

        branchRoot.addChild(leafA);
        branchRoot.addChild(branchA);

        String str = branchRoot.operation();
        System.out.println(str);
    }
}
